package com.ys.erp.stage_config_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;

import com.ys.erp.stage_config_service.bean.condition.ProcureSettingCondition;
import com.ys.erp.stage_config_service.bean.vo.ProcureTransportVO;
import com.ys.erp.stage_config_service.bean.vo.TypeProcureDayVO;
import com.ys.erp.stage_config_service.service.ProcureSettingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 南山
 * @date 2025/07/24 14:35
 */
@ResponseResult
@RestController
@RequiredArgsConstructor
@RequestMapping("/manage/config/procure/setting")
@Tag(name = "采购运输设置", description = "店铺采购运输设置相关接口")
public class ProcureSettingController {

    private final ProcureSettingService procureSettingService;


    @GetMapping("/getProcureDay")
    @CheckEmpLogin
    @Operation(summary = "获取采购设置", description = "获取采购设置")
    public List<TypeProcureDayVO> getProcureDayList(@StageLoginEmp StageEmpDTO empDto) {
        return procureSettingService.getProcureDayList(empDto);
    }

    @PostMapping("/addOrUpdateProcureDay")
    @CheckEmpLogin
    @Operation(summary = "添加或更新采购设置", description = "添加或更新采购设置")
    public void addOrUpdateProcureDay(ProcureSettingCondition.AddOrUpdateProcureDayCon con, @StageLoginEmp StageEmpDTO empDto) {
        procureSettingService.addOrUpdateProcureDay(con, empDto);
    }

    @GetMapping("/delProcureDay")
    @CheckEmpLogin
    @Operation(summary = "删除采购设置", description = "删除采购设置")
    public void delProcureDay(@RequestParam("id") Long id, @StageLoginEmp StageEmpDTO empDto) {
        procureSettingService.delProcureDay(id);
    }

    @GetMapping
    @CheckEmpLogin
    @Operation(summary = "获取采购托运设置", description = "获取采购托运设置")
    public List<ProcureTransportVO> getProcureTransportList(@StageLoginEmp StageEmpDTO empD) {
       return procureSettingService.getProcureTransportList(empD);
    }


    @PostMapping("/addOrUpdateProcureTransport")
    @CheckEmpLogin
    @Operation(summary = "添加或更新采购托运设置", description = "添加或更新采购运输设置")
    public void addOrUpdateProcureTransport(ProcureSettingCondition.AddOrUpdateProcureTransportCon con, @StageLoginEmp StageEmpDTO empDto) {
        procureSettingService.addOrUpdateProcureTransport(con, empDto);
    }

    @GetMapping("/delProcureTransport")
    @CheckEmpLogin
    @Operation(summary = "删除采购托运设置", description = "删除采购托运设置")
    public void delProcureTransport(@StageLoginEmp StageEmpDTO empDto) {
        procureSettingService.delProcureTransport(empDto);
    }

    @GetMapping("/isSticky")
    @CheckEmpLogin
    @Operation(summary = "设置采购设置置顶", description = "设置采购设置置顶")
    public void isSticky(@RequestParam("id") Long id ,@StageLoginEmp StageEmpDTO empDto){
        procureSettingService.isSticky(id,empDto);
    }




}
